import React from 'react';
import {connect} from 'dva';
import styles from './IndexPage.css';
import Ui from '../components/Weather'

class App extends React.Component {

  render() {
    const {pm25, pm10, temperature, quality, dispatch}=this.props;

    const getDate = () => dispatch({type: 'weather/getData'});

    return (
      <div style={{
        backgroundImage: 'url(https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490256195458&di=5e7275414e690bf8fdaea04634d963ec&imgtype=0&src=http%3A%2F%2Fimg16.3lian.com%2Fgif2016%2Fq4%2F49%2F61.jpg)'
      }}
      >
        <Ui
          getDate={getDate}
          pm25={pm25}
          pm10={pm10}
          temperature={temperature}
          quality={quality}
        />
      </div>
    );
  }

}

const IndexPageProp = ({weather}) => ({...weather});


export default connect(IndexPageProp)(App);
